package com.ziven.common.widget.value;

import android.view.View;

import androidx.annotation.NonNull;

import com.ziven.easygo.util.ViewHelper;

/**
 * @author Ziven
 */
public final class Visibility extends Value {

    public static Visibility gone() {
        return visibility(View.GONE);
    }

    public static Visibility visible() {
        return visibility(View.VISIBLE);
    }

    public static Visibility invisible() {
        return visibility(View.INVISIBLE);
    }

    public static Visibility visibility(int visibility) {
        return new Visibility().accept(my -> my.value = visibility);
    }

    private Visibility() {}

    @Override
    protected void takeEffect(@NonNull ViewHelper<? extends View> helper) {
        value(Integer.class, helper::setVisibility);
    }
}
